import 'package:boxes_flutter/flutter/slc/common/text_util.dart';

///@author: slc
class UrlUtil {
  //判断一个文本是不是网址
  static bool isUrl(String? text){
    if(TextUtil.isEmpty(text)){
      return false;
    }
    // 使用正则表达式验证 HTTP/HTTPS URL 格式
    final urlPattern = r'^https?:\/\/[^\s/$.?#].[^\s]*$';
    final regex = RegExp(urlPattern);

    return regex.hasMatch(text!);
  }
}
